package com.postracker.initdatabase.db.action.load;

import com.postracker.initdatabase.db.action.DbStatements;
import com.postracker.initdatabase.io.ListOfRows;
import com.postracker.initdatabase.io.TableList;
import com.postracker.initdatabase.io.csv.CsvFileFactory;
import com.postracker.initdatabase.io.txt.TxtFileFactory;

public final class LoadFactory {
	private static final LoadFactory INSTANCE = new LoadFactory();

	private LoadFactory() {
		// Limiting the scope
	}

	public static LoadFactory getInstance() {
		return INSTANCE;
	}

	public DbStatements createStmtsListFromFile(String filePath) {
		ListOfRows stmtsFile = TxtFileFactory.getInstance().createStmtsFile(
				filePath);
		return new ListOfRowsWithData(stmtsFile);
	}

	public DbStatements createInsertStmtsFromFolder(String folderPath) {
		TableList tablesFromFolder = CsvFileFactory.getInstance()
				.createTablesFromFolder(folderPath);
		return new TablesWithData(tablesFromFolder, new InbsertTableRow());
	}
}
